/**
 ***********************************************************************************************************
 * 
 ***********************************************************************************************************
 * @file RBD3D9Texture.h
 ***********************************************************************************************************/

#ifndef __RBD3D9TEXTURE_H__
#define __RBD3D9TEXTURE_H__

#ifdef  HEADER_ONCE
#pragma HEADER_ONCE
#endif

#ifdef  HEADER_MSG
#pragma HEADER_MSG(RBD3D9Texture.h)
#endif

/***********************************************************************************************************
 * Includes
 ***********************************************************************************************************/
#include <RBMain/RBTexture.h>
#include <RBMain/RBString.h>

/***********************************************************************************************************
 * Forward declarations
 ***********************************************************************************************************/
struct IDirect3DBaseTexture9;
class RBD3D9Renderer;

/***********************************************************************************************************
 * Classes
 ***********************************************************************************************************/

class RBD3D9Texture : public RBTexture
{
    RBDeclareRTTI(RBD3D9Texture, RBTexture);
public:

				                RBD3D9Texture   (const char* pcFilename, RBHardwareBufferManager* pCreator);
								RBD3D9Texture   (uint32 uiTextureUsage, RBHardwareBufferManager* pCreator,
                                                 uint32 uiWidth, uint32 uiHeight, RBPixelFormat eFormat, RBTextureType::EType eType, uint32 uiMips = 0, uint32 uiDepth = 0, uint32 eMemPool = 1);

    virtual                    ~RBD3D9Texture   ();

    IDirect3DBaseTexture9*      GetTexture      () const { return m_pD3DTexture; }
    
    virtual void                Resize          (uint32 uiWidth, uint32 uiHeight);
    virtual void                OnReset         (bool bBeforeReset);

private:
    void                        CreatePixelBuffers  (RBHardwareBufferManager* pCreator, uint32 uiMemPoolMask);
    void                        InitPixelBuffers    ();
    bool                        CreateFromFile      ();
    bool                        CreateFromScratch   (uint32 uiMips);

private:
    IDirect3DBaseTexture9*		m_pD3DTexture;
};

/***********************************************************************************************************/

#endif // __RBD3D9TEXTURE_H__